home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Application_VBScript.asp < prev    next >
Encoding:
Text File  |  1998-05-29  |  2.0 KB  |  68 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3.  
  4. <!*************************
  5. This sample is provided for educational purposes only. It is not intended to be 
  6. used in a production environment, has not been tested in a production environment, 
  7. and Microsoft will not provide technical support for it. 
  8. *************************>
  9.  
  10. <%
  11.     'Ensure that this page is not cached.
  12.  
  13.     Response.Expires = 0
  14. %>
  15.  
  16. <HTML>
  17.     <HEAD>
  18.         <TITLE>Using Application Variables</TITLE>
  19.     </HEAD>
  20.  
  21.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  22.  
  23.         <!-- Display header. -->
  24.  
  25.         <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  26.         <B>Using Application Variables</B></FONT><BR>
  27.       
  28.         <HR SIZE="1" COLOR="#000000">
  29.  
  30.  
  31.         <%
  32.             'If this is the first time any user has visited
  33.             'the page, initialize Application Value.
  34.  
  35.             If (Application("AppPageCountVB") = "") Then
  36.                 Application("AppPageCountVB") = 0
  37.             End If
  38.  
  39.  
  40.             'Increment the Application AppPageCount by one.
  41.             'Note that this AppPageCount value is being
  42.             'shared, locking must be used to prevent 
  43.             'two sessions from simultaneously attempting 
  44.             'to update the value. However, for a single statement you 
  45.         'don't need to apply locks (it already is applied.)
  46.  
  47.             'Application.Lock
  48.             Application("AppPageCountVB") = Application("AppPageCountVB") + 1
  49.             'Application.UnLock
  50.         %>
  51.  
  52.  
  53.         <!-- Output the Application Page Counter value. -->
  54.         <!-- Note that locking does not need to be used -->
  55.         <!-- because the value is not being changed by -->
  56.         <!-- this user session. -->
  57.  
  58.         Users have visited this page 
  59.         <%= Application("AppPageCountVB") %> times!
  60.  
  61.  
  62.         <!-- Provide a link to revisit the page. -->
  63.  
  64.         <P><A HREF="Application_VBScript.asp">Click here to visit it again</A>
  65.  
  66.     </BODY>
  67. </HTML>
  68.